<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="com.twoscreen.TUser"%>
<%@ page import="com.twoscreen.Points"%>
<%@ page import="com.google.appengine.api.users.User" %>
<%@ page import="com.google.appengine.api.users.UserService" %>
<%@ page import="com.google.appengine.api.users.UserServiceFactory" %>
<%
	//Variables
	UserService userService = UserServiceFactory.getUserService();
	User user = userService.getCurrentUser();
	String thisURL = request.getRequestURL().toString();
	TUser tuser = null;
	String username = null;
	String points = null;
	String correctAnswers = null;

	if (user != null) {
		tuser = TUser.getTUser(user);
		username = tuser.getUserName();
		points = Points.getPointsTotal(tuser);
	}
%>
<!doctype html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta http-equiv="cache-control" content="no-store, no-cache, must-revalidate, max-age=1" />
		<meta http-equiv="pragma" content="no-cache" />
		<meta http-equiv="expires" value="1" />
		<title>Two-Screen | Cookie Policy</title>
		<link rel="shortcut icon" href="/images/favicon.ico" />
		<link href='https://fonts.googleapis.com/css?family=Montserrat|Exo:200,400' rel='stylesheet' type='text/css' />
		<link href="/css/web.css" rel="stylesheet" type="text/css" />
		<link rel="stylesheet" type="text/css" href="/css/jquery.fancybox.css?v=2.1.2" media="screen" />
		<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
		<script type="text/javascript" src="/js/jquery.fancybox.js?v=2.1.3"></script>
		<script type="text/javascript" src="/js/userUpdateWeb.js"></script>
		<script type="text/javascript" src="/js/cufon-yui.js"></script>
		<script type="text/javascript" src="/js/College_700.font.js"></script>
		<script type="text/javascript">
			Cufon.replace('h1#logo');
		</script>
		<script type="text/javascript">
			var _gaq = _gaq || [];
			_gaq.push(['_setAccount', 'UA-35281811-1']);
			_gaq.push(['_trackPageview']);
			
			(function() {
			  var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
			  ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
			  var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
			})();
		</script>
	</head>
	<body onload="" onunload="">
	
		<div id="head-bg">
			<div class="inner-wrapper">
				<div id="header">
					<div id="head-logo">
						<a href="/"><img id="logo" alt="home" src="/images/logo2.png" /></a>
						<h1 id="logo"><a href="/">Two-screen</a></h1>
					</div>
					<ul class="menu">

<% 
	if (user != null) {
%>
				
						<li id="head-user">
							<h3 class="menu">you</h3>
							<ul class="head-sub">
								<li class="noHover"><h3>points: <%= points %></h3></li>
								<li><h3><a class="fancybox" href="#username-update-dialog">update username</a></h3></li>
								<li><h3>
										<a class="head-link" href="<%= userService.createLogoutURL(thisURL) %>">log out</a>
									</h3>
								</li>
							</ul>
						</li>
						

<% 
	} else {
%>
				
						<li id="head-user">
							<h3 class="menu"><a class="head-link" href="<%= userService.createLoginURL(thisURL) %>">log in</a></h3>
						</li>
				
<% 
	}
%>				
				
					
						<li id="head-explore">
							<h3 class="menu"><a class="head-link" href="/connect.jsp">watch</a></h3>
						</li>
						
						
						<li id="head-create">
							<h3 class="menu"><a class="head-link" href="/producers/index.jsp">create</a></h3>
						</li>
					</ul>
					
				</div>
				<div class="clear"></div>
			</div>
		</div>
	
		<div id="home-bg">
			<div class="inner-wrapper">
				<h1>Cookie Policy</h1>
				<p>A cookie is a small text file that is stored to your device which contains a type of unique code, 
					these files are read and set by a web server. Only the web server that set a cookie can set or read it.</p>
				<p>A lot of web sites use cookies to improve the user experience by recognising you while you are on 
					the site and in some instances when you return to the site.</p>
				<p>If we did not use cookies we would not be able to recognise you when you move from page to page; for example 
					you would have to sign in every time you viewed a different page on the site.</p>
				<p>You can set your browser to refuse cookies, however this will result in you not being able to log-in to the 
					service. By using this service and not setting your browser to refuse cookies you are consenting to us saving 
					cookies on your computer.</p>
				<p>We have tried to use a minimal amount of cookies, the cookies we set are used for:</p>
				<ul class="policy">
					<li>Storing your user credentials: this allows us to recognise who is signed in</li>
					<li>Collecting anonymised information on your browsing of the site: this allows us to spot any trends and improve the service</li>
					<li>Allowing your TV and interactive device to communicate</li>
				</ul>
				<br />
				<h3>Strictly necessary cookies:</h3>
				<p>These cookies are used to store your user credentials</p>
				<ul class="policy">
					<li>ACSID</li>
					<li>SACSID</li>
				</ul>
				<br />
				<h3>Performance cookies:</h3>
				<p>These cookies are used to collecting anonymised information on your browsing of the site</p>
				<ul class="policy">
					<li>_utma</li>
					<li>_utmb</li>
					<li>_utmc</li>
					<li>_utmz</li>
				</ul>
				<br />
				<h3>Functionality cookies:</h3>
				<p>These cookies are used to allow your TV and interactive device to communicate and create interactive videos</p>
				<ul class="policy">
					<li>S</li>
					<li>psID</li>
					<li>access</li>
					<li>expiry</li>
					<li>chtoken</li>
					<li>cookie-dismiss</li>
				</ul>
				<br />
				<h3>Targeting cookies:</h3>
				<p>We do not set these directly, however interactive content is created by viewers so third party cookies may be set in this category.</p>
				<br />
				<h3>Third party cookies are also set in relation to the services we provide, these cookies are detailed below:</h3>
				<ul class="policy">
					<li>PREF (YouTube)</li>
					<li>VISITOR_INFO1_LIVE (YouTube)</li>
					<li>APISID (YouTube)</li>
					<li>HSID (YouTube)</li>
					<li>SAPISID (YouTube)</li>
					<li>SID (YouTube)</li>
					<li>SSID (YouTube)</li>
					<li>GALX (Google accounts)</li>
					<li>GAPS (Google accounts)</li>
					<li>LSID (Google accounts)</li>
					<li>GoogleAccountsLocale_session (Google accounts)</li>
					<li>CheckConnectionTempCookie (Google accounts)</li>
					<li>APISID (Google)</li>
					<li>HSID (Google)</li>
					<li>NID (Google)</li>
					<li>SAPISID (Google)</li>
					<li>SID (Google)</li>
					<li>SSID (Google)</li>
				</ul>
				<br />
				<br />
			</div>
		</div>
		<div id="username-update-dialog" style="width:400px;display: none;">
			<h3>Update user name: <span id="currentUn"><%= username %></span></h3>
			<br>
			<label for="username">User name:</label><input type="text" name="username" id="username-input">
			<br>
			<p id="unError"></p>
			<div id="unSuggestions"></div>
			<button type="button" onclick="userSave()">Save</button>
		</div>
		<div id="username-success" style="width:400px;display: none;">
			<h3 class="success">User name saved</h3>
		</div>
		
		<%@ include file="/include/footer.html" %>
		
	</body>
</html>